package com.hero.herocat;

import com.hero.servlet.HeroRequest;
import com.hero.servlet.HeroResponse;
import com.hero.servlet.HeroServlet;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author linhui
 */
public class DefaultCustomServlet extends HeroServlet {
    @Override
    public void doGet(HeroRequest request, HeroResponse response) throws Exception {
        Map<String,Object> map = new LinkedHashMap<>();
        map.put("timeStamp", System.currentTimeMillis());
        map.put("status", 404);
        map.put("error", "Not Found");
        map.put("message", "No message available");
        map.put("path",request.getPath());
        response.write(map);
    }

    @Override
    public void doPost(HeroRequest request, HeroResponse response) throws Exception {
        doGet(request, response);
    }
}
